<?php
class M_private_message extends CI_Model{
 
    function __construct()
    {
        parent::__construct();
    }
    
    function input_komentar()
    {
        $now = date('Y-m-d');
        $simpan_data =  array(
                        'ID_Barang'     => $this->input->post('idbarang'),
                        'Description'   => $this->input->post('deskripsi'),
                        'Status'        => $this->input->post('status'),
                        'Tanggal'       => $now
                        );
        $simpan = $this->db->insert('jb_private_m', $simpan_data);
        return $simpan;
    }
    
    function edit_komentar()
    {
        $id = $this->input->post('idpm');
        $edit_data =    array(
                        'ID_Barang'     => $this->input->post('idbarang'),
                        'Description'   => $this->input->post('deskripsi'),
                        'Status'        => $this->input->post('status'),
                        'Tanggal'       => $now
                        );
        $this->db->where('ID_PM',$id);
        $this->db->update('jb_private_m',$edit_data);
    }
    
    function get_komentar()
    {
        $params = $this->db->get('jb_private_m');
        return $params->result();
    }
}